package com.css.bjdt_core.reportPrepare.service;

import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.nutz.dao.Condition;
import org.nutz.dao.Dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.css.bjdt_core.annual.entity.RptAnnual;
import com.css.bjdt_core.util.CommonUtil;
import com.css.bjdt_core.util.PageQuerys;

@Service
public class RptAnnualService {
	@Autowired
	private Dao dao;

	/**
	 * 新增统计年度报表
	 * @param record
	 * @return
	 */
	public RptAnnual insert(RptAnnual record) {
		if (StringUtils.isEmpty(record.getAnnualId())) {
			record.setAnnualId(CommonUtil.getUUID());
		}
		return dao.insert(record);
	}

	/**
	 * 更新统计年度报表
	 * @param record
	 * @return
	 */
	public int update(RptAnnual record) {
		return dao.updateIgnoreNull(record);
	}

	/**
	 * 分页查询统计年度报表
	 * @param cnd
	 * @return
	 */
	public Map queryPage(Condition cnd, int pageNum, int pageSize) {
		return PageQuerys.ligerGridQuery(dao, RptAnnual.class, cnd, pageNum, pageSize);
	}

	/**
	 * 根据id查询相关统计年度报表
	 * @param id
	 * @return
	 */
	public RptAnnual queryByID(String id) {
		return dao.fetch(RptAnnual.class, id);
	}

}
